import { translateByCode } from '@/lib/getTransData.js';
import validator from '../index.js';
import { RegisterUserInput } from '@/lib/form/swaggerForm.js';
console.log(translateByCode('route.dashboard'));

export class ForgetPasswordVO_Rules extends RegisterUserInput { // ForgetPasswordVO表单的验证规则
  constructor() {
    super();
    this.phoneNumber = [
      validator.required(translateByCode('rules.requiredUserName')),
      {
        validator (rule, value, callback) {
          callback(validator.checkPhone(value, translateByCode('rules.validTelephone')));
        },
        trigger: 'blur'
      }
    ];
    this.password = [
      validator.required(translateByCode('rules.requiredPassword')),
      {
        validator (rule, value, callback) {
          callback(validator.checkPwd(value, translateByCode('rules.validPassword')));
        },
        trigger: 'blur'
      }
    ];
    this.code = [
      {
        required: true,
        message: translateByCode('rules.verifyCode'),
        trigger: 'blur'
      },
      {
        min: 6,
        max: 6,
        message: translateByCode('rules.validVerifyCode'),
        trigger: 'blur'
      }
    ];
  }
}
